import 'core-js/stable';
const runtime = require('@wailsapp/runtime');


// Main entry point
function start() {
	// Ensure the default app div is 100% wide/high
	var app = document.getElementById('app');
	app.style.width = '100%';
	app.style.height = '100%';

	var mystore = runtime.Store.New('store');

	// Inject html
	app.innerHTML = `
	<div class='logo'></div>
	<div class='container'>
		<input id='getvalue' type="text" value=""/>
		<div id='setvalue'>welcome </div>
		<button id="btn">welcome</button>
	</div>
	`;

	document.getElementById('btn').onclick = function() {
		var t = document.getElementById("getvalue").value
		window.backend.Handler.Hello(t).then(function (v){
			mystore.set(v)
		}, function () {})
	};

	mystore.subscribe( function(state) {
		document.getElementById('setvalue').innerHTML = state;
	});

};



// We provide our entrypoint as a callback for runtime.Init
runtime.Init(start);